layui.use(['form', 'layer', 'layedit', 'laydate', 'upload'], function () {
    var form = layui.form
    layer = parent.layer === undefined ? layui.layer : top.layer,
        laypage = layui.laypage,
        upload = layui.upload,
        layedit = layui.layedit,
        laydate = layui.laydate,
        $ = layui.jquery;

    form.on("submit(addConfig)", function (data) {
        //弹出loading
        var index = layer.msg('数据提交中，请稍候', {icon: 16, time: false, shade: 0.8});
        // 实际使用时的提交信息
        $.ajax({
            type: "post",
            url: "/manage/myinfo/save",
            dataType: "json",
            data: $("#submitForm").serialize(),
            success: function (result) {
                if (result.flag == "success") {
                    top.layer.msg("保存成功！" , {icon: 1});

                }else {
                    layer.msg("保存失败", {icon: 2});
                }
            }, error: function () {
                layer.msg("保存失败", {icon: 2});
            }

        });
    })

    //关闭
    $(".close").on("click", function () {
        parent.layer.close(parent.layer.getFrameIndex(window.name));
    });

})